dsunite.load();
function format_todate(val){
				return Ext.util.Format.date(val,'Y-m-d');
			}

/*************************Ens_Ue************************************/
var fieldset_enseignant = [{
			columnWidth: 0.4,
            xtype: 'fieldset',
            labelWidth: 120,
            title:'enseignant',
			id:'fieldsetenseignant',
            defaults: {width: 140},	// 
            defaultType: 'textfield',
            autoHeight: true,
            bodyStyle: Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;',
            border: true,
            style: {
                'margin-left': '10px', // when you add custom margin in IE 6...
                'margin-right': Ext.isIE6 ? (Ext.isStrict ? '-10px' : '-13px') : '0'  // you have to adjust for it somewhere else
            },
            items: [
			        {
						xtype:'textfield',
						fieldLabel: 'CIN',
						name: 'cin',
						id: 'cin'
						//allowBlank:false
					},
					{
						xtype:'textfield',
						fieldLabel: 'Nom',
						name: 'nom_enseig',
						id: 'nom_enseig',
						allowBlank:false
					},
					
					{
						xtype:'textfield',
						fieldLabel: 'Prénom',
						name: 'prenom_enseig',
						id: 'prenom_enseig',
						allowBlank:false
					},
					
					{
						xtype:'textfield',
						fieldLabel: 'Tél mobile',
						name: 'tel_mobile',
						id: 'tel_mobile',
						allowBlank:false
					},
					
					{
						xtype:'textfield',
						fieldLabel: 'Tél.',
						name: 'tel',
						id: 'tel',
						//allowBlank:false
					},
					
					{
						xtype:'textfield',
						fieldLabel: 'Fax',
						name: 'fax',
						id: 'fax',
						//allowBlank:false
					},
						
					{
						xtype:'textfield',
						fieldLabel: 'E-mail',
						vtype:'email',
						name: 'mail',
						id: 'mail',
						allowBlank:false
					}
					,
					
					
					{
						xtype:'combo',
						fieldLabel: 'Grade',
						name: 'grade',
						id: 'grade',
						store : dsgrade,
						triggerAction: 'all',
			            autocomplete: true,
						displayField :  'libelle',
						valueField :  'code_grade',
						width:140,

						emptyText : '0bligatoire'
					},
				
				
				{
						xtype:'combo',
						fieldLabel: 'Universite',
						name: 'code_universite',
						id: 'code_universite',
						store : dsuniversite,
						triggerAction: 'all',
			            autocomplete: true,
						displayField :  'LIB_UNIVERSITE',
						valueField :  'CODE_UNIVERSITE',
						width:140,

						emptyText : '0bligatoire'
					},
					
					{
						xtype:'combo',
						fieldLabel: 'Etablissement',
						name: 'code_etablissement',
						id: 'code_etablissement',
						store : dsetablissement,
						triggerAction: 'all',
			            autocomplete: true,
						displayField :  'LIB_ETABLISSEMENT',
						valueField :  'CODE_ETABLISSEMENT',
						width:140,

						emptyText : '0bligatoire'
					},
				
					
				{
					xtype:'hidden',
					name: 'code_ens',
					id: 'code_ens'
					//allowBlank:false
				}
				
			]
	}];

		
var colModelenseignant =new Ext.grid.ColumnModel([
        {header:'cin',  sortable: true,  dataIndex: 'cin'},
		{header:'nom_enseig',  sortable: true,  dataIndex: 'nom_enseig'},
		{header:'prenom_enseig',  sortable: true,  dataIndex: 'prenom_enseig'},
		{header:'tel_mobile',  sortable: true,  dataIndex: 'tel_mobile'},
		{header:'tel',  sortable: true,  dataIndex: 'tel'},
		{header:'fax',  sortable: true,  dataIndex: 'fax'},
		{header:'mail',  sortable: true,  dataIndex: 'mail'},
		{header:'grade',  sortable: true,  dataIndex: 'grade'},
		//{header:'specialite',  sortable: true,  dataIndex: 'specialite'},
		{header:'code_universite',  sortable: true,  dataIndex: 'code_universite'},
		{header:'code_etablissement',  sortable: true,  dataIndex: 'code_etablissement'},
		//{header:'login',  sortable: true,  dataIndex: 'login'},
		//{header:'motpasse',  sortable: true,  dataIndex: 'motpasse'},
		{id:'cin',header: "ID", width:3, sortable: true,  dataIndex: 'cin'}
]);

		var grid_enseignant=[{
				columnWidth: 0.5,
				xtype:'fieldset',
				id:'grid_enseignant',
				layout: 'fit',
	            items: {
		            xtype: 'grid',
		            ds: dsenseignant,
		            cm: colModelenseignant,
					id:'gridenseignant',
		            sm: new Ext.grid.RowSelectionModel({
		                singleSelect: true,
		                listeners: {
		                    rowselect: function(sm, row, rec) {
								Ext.getCmp('formenseignant').getForm().loadRecord(rec);
								Ext.getCmp('DELETE_ENS').enable();
								Ext.getCmp('UPDATE_ENS').enable();
								Ext.getCmp('INSERT_ENS').disable();
		                    }
		                }
		            }),
		            autoExpandColumn: 'cin',
		            height: 150,
		            title:'liste des enseignant',
		            border: true,
			        listeners: {
			        	render: function(g) {
			        		g.getSelectionModel().selectRow(0);
			        	},
			        	delay: 10  
			        },
					bbar: new Ext.PagingToolbar({
						pageSize: 20,
						store: dsenseignant,
						displayInfo: true,
						displayMsg: 'Page actuelle {0} - {1} of {2}',
						emptyMsg: 'Pas de résultat'
					})
	        	}
	        }];
		/*Ext.onReady(function(){
		    Ext.QuickTips.init(); 
		    Ext.form.Field.prototype.msgTarget = 'side';
		    var bd = Ext.getBody();*/
			
			
		
			dsenseignant.load(
				{
					waitMsgTarget: true,
					waitMsg:'chargement en cours ...',
					params:{start: 0, limit: 20},
					callback: function(records, options, success){
						if(!success){
							MsgErreurChargement('ERREUR d\'execution de requette de chargement');
						}
					}
				});	
					
		    var form_ens = new Ext.FormPanel({
		        id: 'formenseignant',
		        autoWidth : true,
				autoHeight : true,
				form:true,
				frame: true,
		        labelAlign: 'left',
		        title: 'reunion',
		        bodyStyle:'padding:5px',
		       
		        layout: 'column',	// Specifies that the items will now be arranged in columns
			        
				title: 'enseignant',
				items: [
					grid_enseignant,
					fieldset_enseignant 
					
				],buttons:[
						{
            	text: 'Ajouter',
				id:'Ajouter_ENS',
		  		handler: function(){
						form_ens.getForm().reset();	
						Ext.getCmp('INSERT_ENS').enable();
						Ext.getCmp('DELETE_ENS').disable();
						Ext.getCmp('UPDATE_ENS').disable();
					}
			},
						{
				 text: 'Inseret',
				 id:'INSERT_ENS',
				 disabled:true,
		  		 handler: function(){
		   					if (form_ens.getForm().isValid()) {
								var box = Ext.MessageBox.wait('opération en cours...', 'Mise a jours réuissi');
								
								Ext.Ajax.request({
									url: 'core/frm/action/enseignant.action.php',
									method: 'POST',
									id: 'update_request',
									params: {
		
										nom_enseig: Ext.getCmp('nom_enseig').getValue(),
										prenom_enseig: Ext.getCmp('prenom_enseig').getValue(),
										tel_mobile: Ext.getCmp('tel_mobile').getValue(),
										tel: Ext.getCmp('tel').getValue(),
										fax: Ext.getCmp('fax').getValue(),
										mail: Ext.getCmp('mail').getValue(),
										grade: Ext.getCmp('grade').getValue(),
										//specialite: Ext.getCmp('specialite').getValue(),
										code_universite: Ext.getCmp('code_universite').getValue(),
										code_etablissement: Ext.getCmp('code_etablissement').getValue(),
										//login: Ext.getCmp('login').getValue(),
										//motpasse: Ext.getCmp('motpasse').getValue(),
										cin: Ext.getCmp('cin').getValue(),


                                        code_ens: Ext.getCmp('cin').getValue(),
										code_ue:  Ext.getCmp('code_ue').getValue(),
										//login: Ext.getCmp('login').getValue(),
										//motpasse: Ext.getCmp('motpasse').getValue(),
										role: "Enseiganant concepteur",





										operation: 'INSERT_ENS'
									},
									callback: function(options, success, response){
										var result = Ext.util.JSON.decode(response.responseText);
										
										if(result.success=='true'){
											dsenseignant.reload();
											Ext.getCmp('grid_enseignant').doLayout();
											Ext.getCmp('DELETE_ENS').disable();
											Ext.getCmp('UPDATE_ENS').disable();
											Ext.getCmp('INSERT_ENS').disable();
											box.hide();
											DBMsgInfo('');
										}else{
											box.hide();
											DBMsgErreur('');
										}					
									}
								});
							}
							else{
								MsgErreurChamps('');
							}
					}
		},
						{
				 text: 'Supprimer',
				 id:'DELETE_ENS',
				 disabled:true,
		  		 handler: function(){
		   					if (form_ens.getForm().isValid()) {
								var box = Ext.MessageBox.wait('opération en cours...', 'Mise a jours réuissi');
								
								Ext.Ajax.request({
									url: 'core/frm/action/enseignant.action.php',
									method: 'POST',
									id: 'update_request',
									params: {
												cin: Ext.getCmp('cin').getValue(),

										operation: 'DELETE_ENS'
									},
									callback: function(options, success, response){
										var result = Ext.util.JSON.decode(response.responseText);
										
										if(result.success=='true'){
											dsenseignant.reload();
											Ext.getCmp('grid_enseignant').doLayout();form_ens.getForm().reset();
											Ext.getCmp('DELETE_ENS').disable();
											Ext.getCmp('UPDATE_ENS').disable();
											Ext.getCmp('INSERT_ENS').disable();
											box.hide();
											DBMsgInfo('');
										}else{
											box.hide();
											DBMsgErreur('');
										}					
									}
								});
							}
							else{
								MsgErreurChamps('');
							}
					}
		},
						{
				 text: 'Mettre à jour',
				 id:'UPDATE_ENS',
				 disabled:true,
		  		 handler: function(){
		   					if (form_ens.getForm().isValid()) {
								var box = Ext.MessageBox.wait('opération en cours...', 'Mise a jours réuissi');
								
								Ext.Ajax.request({
									url: 'core/frm/action/enseignant.action.php',
									method: 'POST',
									id: 'update_request',
									params: {
		
										nom_enseig: Ext.getCmp('nom_enseig').getValue(),
										prenom_enseig: Ext.getCmp('prenom_enseig').getValue(),
										tel_mobile: Ext.getCmp('tel_mobile').getValue(),
										tel: Ext.getCmp('tel').getValue(),
										fax: Ext.getCmp('fax').getValue(),
										mail: Ext.getCmp('mail').getValue(),
										grade: Ext.getCmp('grade').getValue(),
										//specialite: Ext.getCmp('specialite').getValue(),
										code_universite: Ext.getCmp('code_universite').getValue(),
										code_etablissement: Ext.getCmp('code_etablissement').getValue(),
										//login: Ext.getCmp('login').getValue(),
										//motpasse: Ext.getCmp('motpasse').getValue(),
										cin: Ext.getCmp('cin').getValue(),

										operation: 'UPDATE_ENS'
									},
									callback: function(options, success, response){
										var result = Ext.util.JSON.decode(response.responseText);
										
										if(result.success=='true'){
											dsenseignant.reload();
											Ext.getCmp('grid_enseignant').doLayout();
											Ext.getCmp('DELETE_ENS').disable();
											Ext.getCmp('UPDATE_ENS').disable();
											Ext.getCmp('INSERT_ENS').disable();
											box.hide();
											DBMsgInfo('');
										}else{
											box.hide();
											DBMsgErreur('');
										}					
									}
								});
							}
							else{
								MsgErreurChamps('');
							}
					}
		}
					]
		        		
		    });
		   
		
		
	 var gridFormenseignant = new Ext.Window({
				id:"wformens",
				name:"wformens",
				width:890,
				title:'Enseignant concepteur',
				closeAction:'hide',
				   plain: true,
				items: [form_ens
					]
		        		
		    });	
		
		
/*******************************************************************/










var fieldset_unite = [{
			columnWidth: 0.4,
            xtype: 'fieldset',
            labelWidth: 120,
            title:'Unités en attente',
			id:'fieldsetunite',
            defaults: {width: 140},	// 
            defaultType: 'textfield',
            autoHeight: true,
            bodyStyle: Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;',
            border: true,
            style: {
                'margin-left': '10px', // when you add custom margin in IE 6...
                'margin-right': Ext.isIE6 ? (Ext.isStrict ? '-10px' : '-13px') : '0'  // you have to adjust for it somewhere else
            },
            items: [
			
					{
						xtype:'textfield',
						fieldLabel: 'Unité d’enseignement(UE)',
						name: 'lib_unite',
						id: 'lib_unite',
						allowBlank:false
					},
					{
						xtype:'textfield',
						fieldLabel: 'Nature de l’«UE»',
						name: 'nature_unite',
						id: 'nature_unite',
						allowBlank:false
					},		
					{
						xtype: 'fieldset',
						id: 'g1',
						name: 'g1',
						collapsed: true,
						collapsible: true,
						border: true,
						autoWidth: true,
						autoHieght: true,
						title: 'Information(s) concernant le diplôme',
						
						items: [
						
						
						{
						xtype:'combo',
						fieldLabel: 'Type de diplôme:',
						name: 'code_diplome',
						id: 'code_diplome',
						store : dsdiplome,
						triggerAction: 'all',
			            autocomplete: true,
						displayField :  'LIBELLE_DIPLOME',
						valueField :  'CODE_DIPLOME',
						width:140,

						emptyText : '0bligatoire'
					},
						
						{
						xtype:'combo',
						fieldLabel: 'Domaine',
						name: 'code_domaine',
						id: 'code_domaine',
						store : dsdomaine,
			            triggerAction: 'all',
			            autocomplete: true,
						displayField :  'NOM_DOMAINE',
						valueField :  'CODE_DOMAINE',
						width:140,
						
						emptyText : '0bligatoire'
						},
						{
						xtype:'combo',
						fieldLabel: 'Mention',
						name: 'code_mention',
						id: 'code_mention',
						store : dsmention,
			            triggerAction: 'all',
			            autocomplete: true,
						displayField :  'NOM_MENTION',
						valueField :  'CODE_MENTION',
						width:140,
						
						emptyText : '0bligatoire'
					}, 
						{
						xtype:'textfield',
						fieldLabel: 'Spécialité/Parcours',
						name: 'specialite',
						id: 'specialite'
						//allowBlank:false
					}]},
					{
					xtype:'fieldset',
						id:'g2',
						name:'g2',
						collapsed: true,
						collapsible: true,
						border: true,
						autoWidth:true,
						autoHieght:true,
						title:'Information(s) concernant le Volume horaire ',
					
						items:[
					
					
					
					{
						xtype:'textfield',
						fieldLabel: 'volume_cours',
						name: 'volume_cours',
						id: 'volume_cours',
						allowBlank:false
					},
					
					{
						xtype:'textfield',
						fieldLabel: 'volume_TP',
						name: 'volume_TP',
						id: 'volume_TP',
						allowBlank:false
					},
					
					{
						xtype:'textfield',
						fieldLabel: 'volume_TD',
						name: 'volume_TD',
						id: 'volume_TD',
						allowBlank:false
					}]},
					{
							xtype: 'textfield',
							fieldLabel: 'Semestre',
							name: 'code_niveau',
							id: 'code_niveau',
							allowBlank: false
						},
					{
						xtype:'textfield',
						fieldLabel: 'Coeifficient',
						name: 'coeifficient',
						id: 'coeifficient',
						allowBlank:false
					},
			
					{
						xtype:'textfield',
						fieldLabel: 'Credit',
						name: 'credit',
						id: 'credit',
						allowBlank:false
					},
				
				
					/*****************Indexation***********************/
					{
						xtype: 'fieldset',
						id: 'g33',
						name: 'g33',
						collapsed: true,
						collapsible: true,
						border: true,
						autoWidth: true,
						autoHieght: true,
						title: 'Fiche signalétique de l\'unité d\'enseigement',
						
						items: [
						
						
						{
						
						xtype:'htmleditor',
						fieldLabel: 'Plan du cours',
						name: 'description',
						id: 'description',
						anchor:'90%',
						allowBlank:false
					
					},
						
					
						{
						xtype:'textfield',
						fieldLabel: 'Mots clés',
						name: 'mots_cles',
						id: 'mots_cles',
						allowBlank:false
					},	
					{
						xtype:'textfield',
						fieldLabel: 'Public cible',
						name: 'public_cible',
						id: 'public_cible'
						//allowBlank:false
					},
					{
						xtype:'textfield',
						fieldLabel: 'Pré-requis',
						name: 'nature',
						id: 'nature'
						//allowBlank:false
					},
					{
						xtype:'textarea',
						fieldLabel: 'Objectifs Pédagogiques',
						name: 'objectif',
						id: 'objectif',
						anchor:'95%'
						//allowBlank:false
					}
				
				]},
					
					/**************************************************/					
			
					
				{
					xtype:'hidden',
					name: 'code_ue',
					id: 'code_ue'
					//allowBlank:false
				}
				
			]
			
			/*,buttons:[
				{
					text:"Fiche Ensegiant",
					handler: function(){
					gridFormenseignant.show();
					}}]*/
	}];

		
var colModelunite =new Ext.grid.ColumnModel([
		{header:'Nom unite',  sortable: true,  dataIndex: 'lib_unite'},
		/*{header:'Nature unite',  sortable: true,  dataIndex: 'nature_unite'},
		{header:'Volume Cours',  sortable: true,  dataIndex: 'volume_cours'},
		{header:'Volume TP',  sortable: true,  dataIndex: 'volume_TP'},
		{header:'Volume TD',  sortable: true,  dataIndex: 'volume_TD'},
		{header:'Coeifficient',  sortable: true,  dataIndex: 'coeifficient'},
		{header:'Credit',  sortable: true,  dataIndex: 'credit'},
		{header:'Mention',  sortable: true,  dataIndex: 'code_mention'},
		{header:'Specialite',  sortable: true,  dataIndex: 'specialite'},*/

		
		//{header:'nbr_ens',  sortable: true,  dataIndex: 'nbr_ens'},
		{id:'code_ue',header: "ID", width:3, sortable: true,  dataIndex: 'code_ue'}
]);

		var grid_unite=[{
				columnWidth: 0.4,
				xtype:'fieldset',
				id:'grid_unite',
				layout: 'fit',
	            items: {
		            xtype: 'grid',
		            ds: dsunite,
		            cm: colModelunite,
					id:'gridunite',
		            sm: new Ext.grid.RowSelectionModel({
		                singleSelect: true,
		                listeners: {
		                    rowselect: function(sm, row, rec) {
								Ext.getCmp('formunite').getForm().loadRecord(rec);
								
								//Ext.getCmp('code_ue').setValue("");
								//alert(rec.get('code_ue'));
								/*****************************ens_ue*************************************/
								  dsenseignant.load(
			                       	{
			                 		waitMsgTarget: true,
			                   		waitMsg:'chargement en cours ...',
			                		params:{
			            			operation:'SELECT_ENS',
				              		code_ue: rec.get("code_ue")
				                    		},
				
				                 	callback: function(records, options, success){
				                		if(!success){
					         		MsgErreurChargement('ERREUR d\'execution de requette de chargggggement');
					               	     }
				                 	}
				                    });	
								/******************************indexation********************************/
								dsindexation.load(
												  {
												  	params: {
												  	    description: rec.get("description"),
													//	titre:rec.get("titre"),
													//	discipline:rec.get("discipline"),
														mots_cles:rec.get("mots_cles"),
														public_cible:rec.get("public_cible"),
														objectif:rec.get("objectif"),
														nature:rec.get("nature"),											  
														code_index:rec.get("code_index"),
														code_ue: rec.get("code_ue")
															},
												  	callback: function(records, options, success){
														if (!success) {
															box.hide();
															//Ext.getCmp('formunite').getForm().loadRecord(records[0]);
															Ext.getCmp('mots_cles').setValue(records[0].get('mots_cles').value());
															
															MsgErreurChargement('ERREUR d\'execution de requette de chargement');
															
														}
														else {
															
															Ext.each(records, function(rec){
															   //
																Ext.getCmp('description').setValue(rec.get("description"));
																Ext.getCmp('code_ue').setValue(rec.get("code_ue"));
															//	Ext.getCmp('titre').setValue(rec.get("titre"));
															    Ext.getCmp('nature').setValue(rec.get("nature"));
																Ext.getCmp('mots_cles').setValue(rec.get("mots_cles"));
																Ext.getCmp('public_cible').setValue(rec.get("public_cible"));
																Ext.getCmp('objectif').setValue(rec.get("objectif"));
															//	Ext.getCmp('code_index').setValue(rec.get("code_index"))
																
															});
															
														}
													}
														}
												 );
								  
								
								/*************************************************************************/
								Ext.getCmp('DELETE').enable();
								Ext.getCmp('UPDATE').enable();
								Ext.getCmp('UPDATE1').enable();
		                    }
		                }
		            }),
		            autoExpandColumn: 'code_ue',
		            height: 300,
		            title:'Liste des Unités en Attente',
		            border: true,
			        listeners: {
			        	render: function(g) {
			        		g.getSelectionModel().selectRow(0);
			        	},
			        	delay: 10  
			        },
					bbar: new Ext.PagingToolbar({
						pageSize: 20,
						store: dsunite,
						displayInfo: true,
						displayMsg: 'Page actuelle {0} - {1} of {2}',
						emptyMsg: 'Pas de résultat'
					})
	        	}
	        }];
		Ext.onReady(function(){
		    Ext.QuickTips.init(); 
		    Ext.form.Field.prototype.msgTarget = 'side';
		    var bd = Ext.getBody();
			
			
		
			dsunite.load(
				{
					waitMsgTarget: true,
					waitMsg:'chargement en cours ...',
					params:{start: 0, limit: 20},
					callback: function(records, options, success){
						if(!success){
							MsgErreurChargement('ERREUR d\'execution de requette de chargement');
						}
					}
				});	
					
		    var gridFormunite = new Ext.FormPanel({
		        id: 'formunite',
		        frame: true,
		        labelAlign: 'left',
		        title: 'unite',
		        bodyStyle:'padding:5px',
		        Width: '100%',
		        layout: 'column',	// Specifies that the items will now be arranged in columns
		        renderTo: bd,
				items: [
					grid_unite,
					fieldset_unite 
					
				],buttons:[
						
						{
				 text: 'Mise à jour',
				 id:'UPDATE1',
				 disabled:true,
		  		 handler: function(){
		   					if (gridFormunite.getForm().isValid()) {
								var box = Ext.MessageBox.wait('opération en cours...', 'Mise a jours réuissi');
								
								Ext.Ajax.request({
									url: 'core/frm/action/unite.action.php',
									method: 'POST',
									id: 'update_request',
									params: {
		
										lib_unite: Ext.getCmp('lib_unite').getValue(),
										nature_unite: Ext.getCmp('nature_unite').getValue(),
				
										volume_cours: Ext.getCmp('volume_cours').getValue(),
										volume_TP: Ext.getCmp('volume_TP').getValue(),
										volume_TD: Ext.getCmp('volume_TD').getValue(),
										coeifficient: Ext.getCmp('coeifficient').getValue(),
										code_diplome: Ext.getCmp('code_diplome').getValue(),
										code_niveau: Ext.getCmp('code_niveau').getValue(),
										code_domaine: Ext.getCmp('code_domaine').getValue(),
										credit: Ext.getCmp('credit').getValue(),
										code_mention: Ext.getCmp('code_mention').getValue(),
										specialite: Ext.getCmp('specialite').getValue(),
								        
										
										description: Ext.getCmp('description').getValue(),
										mots_cles: Ext.getCmp('mots_cles').getValue(),
										public_cible: Ext.getCmp('public_cible').getValue(),
										nature: Ext.getCmp('nature').getValue(),
										objectif: Ext.getCmp('objectif').getValue(),
										
										code_ue: Ext.getCmp('code_ue').getValue(),

										operation: 'UPDATE1'
									},
									callback: function(options, success, response){
										var result = Ext.util.JSON.decode(response.responseText);
										
										if(result.success=='true'){
											dsunite.reload();
											Ext.getCmp('grid_unite').doLayout();
											Ext.getCmp('DELETE').disable();
											Ext.getCmp('UPDATE').disable();
										    Ext.getCmp('UPDATE1').disable();
											box.hide();
										MsgErreurChargement(result.result);
										}else{
											box.hide();
											MsgErreurChargement(result.result);
										}					
									}
								});
							}
							else{
								MsgErreurChamps('');
							}
					}
		},
				{
				 text: 'Supprimer',
				 id:'DELETE',
				 disabled:true,
		  		 handler: function(){
		   					if (gridFormunite.getForm().isValid()) {
								var box = Ext.MessageBox.wait('opération en cours...', 'Mise a jours réuissi');
								
								Ext.Ajax.request({
									url: 'core/frm/action/unite.action.php',
									method: 'POST',
									id: 'update_request',
									params: {
												code_ue: Ext.getCmp('code_ue').getValue(),

										operation: 'DELETE'
									},
									callback: function(options, success, response){
										var result = Ext.util.JSON.decode(response.responseText);
										
										if(result.success=='true'){
											dsunite.reload();
											Ext.getCmp('grid_unite').doLayout();gridFormunite.getForm().reset();
											Ext.getCmp('DELETE').disable();
											Ext.getCmp('UPDATE').disable();
											Ext.getCmp('UPDATE1').disable();
											box.hide();
											DBMsgInfo('');
										}else{
											box.hide();
											DBMsgErreur('');
										}					
									}
								});
							}
							else{
								MsgErreurChamps('');
							}
					}
		},
						{
				 text: 'Confirmer la soumission',
				 id:'UPDATE',
				 disabled:true,
		  		 handler: function(){
		   					if (gridFormunite.getForm().isValid()) {
								var box = Ext.MessageBox.wait('opération en cours...', 'Mise a jours réuissi');
								
								Ext.Ajax.request({
									url: 'core/frm/action/unite.action.php',
									method: 'POST',
									id: 'update_request',
									params: {
		
										lib_unite: Ext.getCmp('lib_unite').getValue(),
										nature_unite: Ext.getCmp('nature_unite').getValue(),
										//ECUE: Ext.getCmp('ECUE').getValue(),
										volume_cours: Ext.getCmp('volume_cours').getValue(),
										volume_TP: Ext.getCmp('volume_TP').getValue(),
										volume_TD: Ext.getCmp('volume_TD').getValue(),
										coeifficient: Ext.getCmp('coeifficient').getValue(),
										code_diplome: Ext.getCmp('code_diplome').getValue(),
										code_niveau: Ext.getCmp('code_niveau').getValue(),
										code_domaine: Ext.getCmp('code_domaine').getValue(),
										credit: Ext.getCmp('credit').getValue(),
										code_mention: Ext.getCmp('code_mention').getValue(),
										specialite: Ext.getCmp('specialite').getValue(),
										etat_soumission:"1",
										code_ue: Ext.getCmp('code_ue').getValue(),

										operation: 'UPDATE'
									},
									callback: function(options, success, response){
										var result = Ext.util.JSON.decode(response.responseText);
										
										if(result.success=='true'){
											dsunite.reload();
											Ext.getCmp('grid_unite').doLayout();
											Ext.getCmp('DELETE').disable();
											Ext.getCmp('UPDATE').disable();
										    Ext.getCmp('UPDATE1').disable();
											box.hide();
											DBMsgInfo('');
										}else{
											box.hide();
											DBMsgErreur('');
										}					
									}
								});
							}
							else{
								MsgErreurChamps('');
							}
					}
		}
					]
		        		
		    });
		   
		});
